package com.hub.realtime.common.constant;

import io.jsonwebtoken.Claims;

/**
 * 通用常量信息
 * 
 * @author wupeng
 */
public class Constants
{
    /**
     * UTF-8 字符集
     */
    public static final String UTF8 = "UTF-8";

    /**
     * GBK 字符集
     */
    public static final String GBK = "GBK";

    /**
     * http请求
     */
    public static final String HTTP = "http://";

    /**
     * https请求
     */
    public static final String HTTPS = "https://";

    /**
     * 通用成功标识
     */
    public static final String SUCCESS = "0";

    /**
     * 通用失败标识
     */
    public static final String FAIL = "1";

    /**
     * 登录成功
     */
    public static final String LOGIN_SUCCESS = "Success";

    /**
     * 注销
     */
    public static final String LOGOUT = "Logout";

    /**
     * 注册
     */
    public static final String REGISTER = "Register";

    /**
     * 登录失败
     */
    public static final String LOGIN_FAIL = "Error";

    /**
     * 验证码 redis key
     */
    public static final String CAPTCHA_CODE_KEY = "captcha_codes:";

    /**
     * 登录用户 redis key
     */
    public static final String LOGIN_TOKEN_KEY = "login_tokens:";

    /**
     * 防重提交 redis key
     */
    public static final String REPEAT_SUBMIT_KEY = "repeat_submit:";

    /**
     * 限流 redis key
     */
    public static final String RATE_LIMIT_KEY = "rate_limit:";

    /**
     * 验证码有效期（分钟）
     */
    public static final Integer CAPTCHA_EXPIRATION = 2;

    /**
     * 令牌
     */
    public static final String TOKEN = "token";

    /**
     * 令牌前缀
     */
    public static final String TOKEN_PREFIX = "Bearer ";

    /**
     * 令牌前缀
     */
    public static final String LOGIN_USER_KEY = "login_user_key";

    /**
     * 用户ID
     */
    public static final String JWT_USERID = "userid";

    /**
     * 用户名称
     */
    public static final String JWT_USERNAME = Claims.SUBJECT;

    /**
     * 用户头像
     */
    public static final String JWT_AVATAR = "avatar";

    /**
     * 创建时间
     */
    public static final String JWT_CREATED = "created";

    /**
     * 用户权限
     */
    public static final String JWT_AUTHORITIES = "authorities";

    /**
     * 参数管理 cache key
     */
    public static final String SYS_CONFIG_KEY = "sys_config:";

    /**
     * 字典管理 cache key
     */
    public static final String SYS_DICT_KEY = "sys_dict:";

    /**
     * 资源映射路径 前缀
     */
    public static final String RESOURCE_PREFIX = "/profile";

    /**
     * RMI 远程方法调用
     */
    public static final String LOOKUP_RMI = "rmi://";

    /**
     * LDAP 远程方法调用
     */
    public static final String LOOKUP_LDAP = "ldap://";

    /**
     * 定时任务违规的字符
     */
    public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
            "org.springframework.jndi" };


    public static final String HADOOP_USER_NAME="HADOOP_USER_NAME";


    public static final String JAR_TYPE_TASK="task";
    public static final String JAR_TYPE_DEP="dep";
    public static final String JAR_TYPE_UDF="udf";

    public static  final String LOGBACKDEFAULT="<!--\n" +
            "  ~ Licensed to the Apache Software Foundation (ASF) under one\n" +
            "  ~ or more contributor license agreements.  See the NOTICE file\n" +
            "  ~ distributed with this work for additional information\n" +
            "  ~ regarding copyright ownership.  The ASF licenses this file\n" +
            "  ~ to you under the Apache License, Version 2.0 (the\n" +
            "  ~ \"License\"); you may not use this file except in compliance\n" +
            "  ~ with the License.  You may obtain a copy of the License at\n" +
            "  ~\n" +
            "  ~     http://www.apache.org/licenses/LICENSE-2.0\n" +
            "  ~\n" +
            "  ~ Unless required by applicable law or agreed to in writing, software\n" +
            "  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n" +
            "  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" +
            "  ~ See the License for the specific language governing permissions and\n" +
            "  ~ limitations under the License.\n" +
            "  -->\n" +
            "\n" +
            "<configuration>\n" +
            "    <appender name=\"file\" class=\"ch.qos.logback.core.FileAppender\">\n" +
            "        <file>${log.file}</file>\n" +
            "        <append>false</append>\n" +
            "        <encoder>\n" +
            "            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{60} %X{sourceThread} - %msg%n</pattern>\n" +
            "        </encoder>\n" +
            "    </appender>\n" +
            "\n" +
            "    <!-- This affects logging for both user code and Flink -->\n" +
            "    <root level=\"INFO\">\n" +
            "        <appender-ref ref=\"file\"/>\n" +
            "    </root>\n" +
            "\n" +
            "    <!-- Uncomment this if you want to only change Flink's logging -->\n" +
            "    <!--<logger name=\"org.apache.flink\" level=\"INFO\">-->\n" +
            "        <!--<appender-ref ref=\"file\"/>-->\n" +
            "    <!--</logger>-->\n" +
            "\n" +
            "    <!-- The following lines keep the log level of common libraries/connectors on\n" +
            "         log level INFO. The root logger does not override this. You have to manually\n" +
            "         change the log levels here. -->\n" +
            "    <logger name=\"akka\" level=\"INFO\">\n" +
            "        <appender-ref ref=\"file\"/>\n" +
            "    </logger>\n" +
            "    <logger name=\"org.apache.kafka\" level=\"INFO\">\n" +
            "        <appender-ref ref=\"file\"/>\n" +
            "    </logger>\n" +
            "    <logger name=\"org.apache.hadoop\" level=\"INFO\">\n" +
            "        <appender-ref ref=\"file\"/>\n" +
            "    </logger>\n" +
            "    <logger name=\"org.apache.zookeeper\" level=\"INFO\">\n" +
            "        <appender-ref ref=\"file\"/>\n" +
            "    </logger>\n" +
            "\n" +
            "    <!-- Suppress the irrelevant (wrong) warnings from the Netty channel handler -->\n" +
            "    <logger name=\"org.apache.flink.shaded.akka.org.jboss.netty.channel.DefaultChannelPipeline\" level=\"ERROR\">\n" +
            "        <appender-ref ref=\"file\"/>\n" +
            "    </logger>\n" +
            "</configuration>\n";


}